package com.marchsoft.musicalstore.controller;

import com.marchsoft.musicalstore.entity.Instrument;
import com.marchsoft.musicalstore.entity.SelClassAble;
import com.marchsoft.musicalstore.entity.User;
import com.marchsoft.musicalstore.repository.InstrumentRepository;
import com.marchsoft.musicalstore.service.TextSer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.security.NoSuchAlgorithmException;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 源
 * Date: 2019-11-17
 * Time: 14:47
 */
@RestController
public class Text {

    @Autowired
    TextSer textSer;
    @Autowired
    InstrumentRepository instrumentRepository;

    @RequestMapping("/addUser")
    public User addUser() throws NoSuchAlgorithmException {
        User user = textSer.addUser();
        return user;
    }
    @RequestMapping("/text")
    public SelClassAble abe(){
        SelClassAble selClassAble = textSer.addCourse();
        return selClassAble;
    }

    @RequestMapping("addinstro")
    public Instrument bb(){
        Instrument instrument = new Instrument();
        instrument.setType(1);
        instrument.setPrice(55555);
        instrument.setName("大秦");
        instrument.setAllCount(55);
        instrument.setNowCount(55);
        instrument.setImg("456415641");
        instrument.setIntro("这是奥黛丽赫本的琴");
        Instrument save = instrumentRepository.save(instrument);
        return save;

    }

}
